<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');

$this->load->view('header', array('title' => '创建相册'));
?>
<div class="main">
	<div class="left">
		<div class="menu">
			<p><a href="?c=album&m=index">我的相册</a></p>
			<p class="current"><a href="?c=album&m=add">创建相册</a></p>
            <?php
            if ($this->member->is_admin())
            {
                echo '<p><a href="?c=album&m=manage">管理相册</a></p>';
            }
            ?>
		</div>
		<div class="form">
			<p style="margin-left:100px;padding:5px;">&nbsp;&nbsp;&nbsp;&nbsp;相册名称：<input type="text" id="album_name" style="height:22px;width:300px"></p>
			<p style="margin-left:100px;padding:5px;">微博地址一：<input type="text" id="album_weibo_1" style="height:22px;width:300px"></p>
			<p style="margin-left:100px;padding:5px;">微博地址二：<input type="text" id="album_weibo_2" style="height:22px;width:300px"></p>
			<p style="margin-left:100px;padding:5px;">微博地址三：<input type="text" id="album_weibo_3" style="height:22px;width:300px"></p>
			<p style="margin-left:100px;padding:5px;">微博地址四：<input type="text" id="album_weibo_4" style="height:22px;width:300px"></p>
			<p style="margin-left:100px;padding:5px;">&nbsp;&nbsp;&nbsp;&nbsp;隐私设置：<input type="radio" name="level" value="0" id="level_1"><label for="level_1">对所有人可见</label>&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="level" value="1" id="level_2" checked="checked"><label for="level_2">只对粉丝可见</label></p>
			<p style="margin-left:100px;padding:5px;"><input type="button" id="submit" value="保 存" style="padding:3px;width:100px;margin-left:95px;margin-top:10px;"></p>
		</div>
		<p style="height:10px">&nbsp;</p>
	</div>
    <?php
    $this->load->view('right');
    ?>
</div>
<script type="text/javascript">
$("#album_name").focus();
$(document).ready(function() {
    $("#submit").click(function() {
        var album_name    = $("#album_name").val();
        var album_level   = $('input:radio[name="level"]:checked').val();
        var album_weibo_1 = $("#album_weibo_1").val();
        var album_weibo_2 = $("#album_weibo_2").val();
        var album_weibo_3 = $("#album_weibo_3").val();
        var album_weibo_4 = $("#album_weibo_4").val();

        $("#submit").attr('disabled', 'disabled').val('保存中...');

        $.post('?c=album&m=save&rand=' + Math.random(), {"album_name":album_name,"album_level":album_level,"album_weibo_1":album_weibo_1,"album_weibo_2":album_weibo_2,"album_weibo_3":album_weibo_3,"album_weibo_4":album_weibo_4}, function(response) {

            if (response.error_code)
            {
                alert(response.msg);
                $("#submit").attr('disabled', false).val('保 存');
            }
            else
            {
                location.href = '?c=album&m=picture&id=' + response.album_id;
            }

        },"json");
    });
});
</script>
<?php
$this->load->view('footer');
?>